<?php
    require_once 'all_fns.php';
    
    session_start();
    
    $id = $_POST['id'];
    $passwd = $_POST['passwd'];
    
    if($id && $passwd)
    {
        try
        {
            $userinfo = user_controller::login($id, $passwd, false);
            $_SESSION[STR_valid_user] = $id;
            
            $msg_response = new message($userinfo, 1, STR_object);            
        } 
        catch (Exception $e)
        {
            $msg_response = new message($e->getMessage(), 0, STR_text);
        }
    }
    else {
        $msg_response = new message(
            "id and passwd is needed.", 0, STR_text);
    }
    
    echo json_encode($msg_response);
    exit;
?>



 <?php 
//     require_once 'all_fns.php';
        
//     session_start();
    
//     $userid = user_controller::get_userid();

//     do_header("");
    
//     if($userid!==false)
//     {
//         do_userid($userid);
//     }
//     else 
//     {
//         display_login_form();
//     }

?>